<template>
    <div class="statebox">
        <div class="unitstate allergy" @click="allergytipShow" v-show="'true'===infodata"></div>
        <div class="unitstate hasbaby" v-show="'true'=== babyinfo"></div>
        <div class="allergytip" v-show="tipflag"><img src="../../../static/images/indexone/state03.png">{{alertcont}}</div>
    </div>
</template>

<script>
export default {
  name: 'patientstate',
  props: ['infodata', 'babyinfo', 'alertcont'],
  data () {
    return {
      tipflag: false,
      data: []
    }
  },
  methods: {
    allergytipShow: function () {
      this.tipflag = true
      setTimeout(() => {
        this.tipflag = false
      }, 3000)
    }
  }
}
</script>

<style lang="stylus" scoped>
    .statebox
        margin-top: 0.25rem;
        position: relative;
        .unitstate
            font-size: 0;
            display: inline-block;
            width: 0.34rem;
            height: 0.34rem;
            border-radius: 0.04rem;
            background-size: 100% 100%;
            background-repeat: no-repeat;
            margin: 0 0.08rem;
        .allergy
            background-image: url('../../../static/images/indexone/state01.png');
        .hasbaby
            background-image: url('../../../static/images/indexone/state02.png');
        .allergytip
            background-color: rgba(0,0,0,0.4);
            color: #fff;
            text-align:left;
            position: absolute;
            line-height: 0.4rem;
            font-size: 0.24rem;
            padding: 0.1rem 0.1rem;
            border-radius: 0.05rem;
            left: 50%;
            top: 0.5rem;
            min-width: 3.3rem;
            transform: translate( -50%);
            img
                width: 0.3rem;
                height: 0.3rem;
                display: inline-block;
                margin-right: 0.1rem;
                vertical-align: -0.07rem;

</style>
